package com.cloud.drore.eboss.operation.controller;

import com.cloud.drore.eboos.common.base.PagePo;
import com.cloud.drore.eboos.common.base.ResultMessage;
import com.cloud.drore.eboos.common.entity.supplier.ProductRelation;
import com.cloud.drore.eboos.exception.BusinessException;
import com.cloud.drore.eboss.login.user.Anon;
import com.cloud.drore.eboss.operation.entity.po.OTAGetProductRequest;
import com.cloud.drore.eboss.operation.supplierApiService.IFactoryGetProductApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/3/8 10:21 <br>
 * @Author: <a href="1451173193@qq.com">杨亮</a>
 */
@RestController
@Api(value = "OTA获取产品信息",description = "OTA获取产品信息-杨亮")
@RequestMapping(value = "/factoryTakeProduct")
@Anon
public class FactoryGetProductController {
    @Autowired
    IFactoryGetProductApiService factoryGetProductApiService;
    @ApiOperation("OTA获取产品信息")
    @PostMapping("/getProductInfo")
    public ResultMessage getProductInfo(@RequestBody @Valid PagePo<OTAGetProductRequest> pagePo) throws BusinessException {
    return factoryGetProductApiService.getProductInfo(pagePo);

    }
    @ApiOperation("根据产品编码获取产品id(order表无产品id)")
    @PostMapping("/getProductIdByNum")
    public ResultMessage<ProductRelation> getProductIdByNum(@RequestBody ProductRelation product) throws BusinessException {
        return factoryGetProductApiService.getProductIdByNum(product);

    }

}
